//
//  Encryption.h
//  FoxitApp
//
//  Created by Michael on 3/29/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonCryptor.h>

@interface NSString (MD5)
- (NSString *) md5;
@end

@interface NSData (MD5)
- (NSString*)md5;
@end

@interface NSFileHandle (MD5)
- (NSString *) md5;
@end

@interface NSData (SHA1)
- (NSString*)sha1;
@end

@interface NSString (AES256)
- (NSString *)AES256EncryptWithKey:(NSString *)key;
- (NSString *)AES256DecryptWithKey:(NSString *)key;
@end

@interface NSData (AES256)
- (NSData *)AES256EncryptWithKey:(NSString *)key;
- (NSData *)AES256DecryptWithKey:(NSString *)key;
@end

@interface NSData (AES)
- (NSData *)AES128Operation:(CCOperation)operation key:(NSData *)key iv:(NSData *)iv;
- (NSData *)AES128EncryptWithKey:(NSData *)key iv:(NSData *)iv;
- (NSData *)AES128DecryptWithKey:(NSData *)key iv:(NSData *)iv;
@end

@interface NSData (Base64)
+ (NSData *)dataWithBase64EncodedString:(NSString *)string;
- (id)initWithBase64EncodedString:(NSString *)string;

- (NSString *)base64Encoding;
- (NSString *)base64EncodingWithLineLength:(NSUInteger)lineLength;

- (BOOL)hasPrefixBytes:(const void *)prefix length:(NSUInteger)length;
- (BOOL)hasSuffixBytes:(const void *)suffix length:(NSUInteger)length;
@end
